<%-- 
    Document   : sessionos
    Created on : Mar 9, 2011, 9:21:06 AM
    Author     : matusz
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%

           Integer hiddenszam = (Integer) request.getAttribute("hiddenszam");
           if (hiddenszam==null) hiddenszam = new Integer(0);

           StringBuilder errors = new StringBuilder();
           try{
               hiddenszam = Integer.parseInt(request.getParameter("hiddenszam"));
           } catch(NumberFormatException e){
               errors.append("Hibás 'hiddenszám' paraméter!");

           }

           String muvelet = (String) request.getParameter("muvelet");
           if (muvelet==null) errors.append("Nem jött művelet");

            if (errors.length()==0){

              if (muvelet.equals("Csokkent")){
                  hiddenszam--;
              }
              if (muvelet.equals("Novell")){
                  hiddenszam++;
              }
              if (muvelet.equals("Nullaz")){
                  hiddenszam=0;
              }
        %>


         <form action="feldolgoz.do">

            <input type="hidden"  name="hiddenszam" value="<%=hiddenszam%>" />

            <input type="submit" name="muvelet" value="Csokkent" />
            <input type="submit" name="muvelet" value="Novell" />
            <input type="submit" name="muvelet" value="Nullaz" />
        </form>
    </body>
</html>
